#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 10;
const int M = 1e9 + 7;

int t, n;
int a[N];

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> t;
    while (t--) {
        cin >> n;
        vector<pii> res;
        for (int i = 1; i <= n;i++) cin >> a[i];

        // 找[i...n]最小值
        for (int i = 1; i <= n; i++) {
            int minn = INT_MAX, p = -1;
            for (int j = i; j <= n; j++) {
                if (minn > a[j]) minn = a[j], p = j;
            }

            if (p != i) {
                //p换到i
                int l = i, r = p;
                for (int j = r; j > l; j--) a[j] = a[j - 1];
                a[l] = minn;

                res.push_back({l, r});
            }
        }

        cout << res.size() << endl;
        for(auto p : res) {
            cout << p.first << ' ' << p.second << ' ' << p.second-p.first << endl;
        }
    }
    return 0;
}